package com.thz.friend.controller.course;


import com.thz.common.core.controller.BaseController;
import com.thz.common.core.result.Result;
import com.thz.friend.pojo.course.Course;
import com.thz.friend.pojo.course.vo.CourseVO;
import com.thz.friend.service.course.ICourseService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description
 * @Author thz
 * @Date 2025/5/8
 */
@RestController
@RequestMapping("/course")
@Tag(name = "课程接口")
public class CourseController extends BaseController {

    @Autowired
    private ICourseService courseService;

    @GetMapping("/list")
    public Result<List<Course>> list() {
        return Result.ok(courseService.list());
    }

    /**
     * 获取课程详细信息
     */
    @GetMapping("/detailCourseVO")
    public Result<CourseVO> detailCourseVO(@NonNull @RequestParam("id") Long id) {
        return Result.ok(courseService.selectCourseVOById(id));
    }


}
